package com.ww7h.ui.mvvm.v

import android.os.Bundle
import android.os.PersistableBundle
import androidx.databinding.ViewDataBinding
import androidx.lifecycle.ViewModelStoreOwner
import com.ww7h.ui.base.ui.BaseActivity
import com.ww7h.ui.mvvm.vm.BaseViewModel

/**
 * ================================================
 * 描述：
 * 来源：     Android Studio.
 * 项目名：   BigObj
 * 包名：     com.ww7h.common.mvvm
 * 创建时间：  2020/11/3 02:17
 * @author   ww
 * ================================================
 */
abstract class ViewActivity<VDB: ViewDataBinding> : BaseActivity<VDB>() {

    override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
        super.onCreate(savedInstanceState, persistentState)
        defaultViewDataBinding.root
    }

    protected fun <VM : BaseViewModel> getViewModel(tClass: Class<VM>): VM {
        val viewModelStoreOwner: ViewModelStoreOwner = this
        return viewCommon.getViewModel(viewModelStoreOwner, tClass)
    }
}